Skip to content

feat: add Ideogram 4.0 image provider - #104

Open
balalofernandez wants to merge 1 commit into
shinpr:mainfrom
balalofernandez:feat/ideogram-provider
Open

feat: add Ideogram 4.0 image provider#104
balalofernandez wants to merge 1 commit into
shinpr:mainfrom
balalofernandez:feat/ideogram-provider

Conversation

@balalofernandez

Copy link
Copy Markdown

Summary

Adds a new ideogram image provider (Ideogram 4.0 / v4) alongside the existing Gemini and OpenAI providers, configured the same way via environment variables.

  • New provider client (src/api/ideogramImageClient.ts): createIdeogramImageClient calls the v4 /v1/ideogram-v4/generate endpoint with Api-Key auth and a text_prompt multipart request, then downloads the ephemeral image URL into a Buffer. Follows the same ImageClient/Result patterns as the OpenAI client.

  • Config: new IDEOGRAM_API_KEY env var + validation, gated on IMAGE_PROVIDER=ideogram (mirrors the Gemini/OpenAI key handling).

  • Wiring: mcpServer routes to the Ideogram client when configured; since v4 enhances prompts natively (magic-prompt), the external text-model pipeline is skipped — no separate text client or API key required.

  • IMAGE_QUALITY controls resolution + speed: the preset maps to rendering_speed (TURBO/DEFAULT/QUALITY) and selects the v4 resolution. aspectRatio chooses the orientation only, since v4 ties resolution to aspect ratio (every v4 resolution is ~4 MP).

    IMAGE_QUALITY Landscape Portrait Square
    fast 2560x1440 1440x2560 2048x2048
    balanced 2304x1728 1728x2304 2048x2048
    quality 2496x1664 1664x2496 2048x2048
  • Unsupported on v4 (rejected with clear errors): useGoogleSearch and image-to-image editing — use Gemini/OpenAI for those.

  • Docs (README.md, server.json) updated.

Notes / caveats (v4 API design, not implementation)

  • Square is fixed: v4 has a single square resolution, so for 1:1 / default orientation the preset changes speed but not size.
  • Small size range: all v4 resolutions sit at ~3.7–4.2 MP (~12% spread) — the max v4 exposes; rendering_speed remains the stronger fidelity lever.
  • v3 was intentionally not used (lower quality), per request.

Testing

  • tsc build, Biome check/lint, dependency-cycle, and knip all pass.
  • Full suite: 253 tests pass (17 files), including new ideogramImageClient tests and an Ideogram provider-routing test.
  • Not exercised against the live Ideogram API (no key in this environment); request/response shape is based on the v4 docs and covered by mocked tests.

Add a new `ideogram` image provider (Ideogram 4.0 / v4) alongside the
existing Gemini and OpenAI providers, configured the same way via
environment variables.

- New `createIdeogramImageClient` calling the v4 `text_prompt` generate
  endpoint with `Api-Key` auth; downloads the ephemeral image URL.
- `IDEOGRAM_API_KEY` config + validation, gated on `IMAGE_PROVIDER=ideogram`.
- `IMAGE_QUALITY` drives both rendering speed (TURBO/DEFAULT/QUALITY) and
  the v4 resolution (aspect ratio selects orientation only, since v4 ties
  resolution to aspect ratio).
- Prompt enhancement handled natively by Ideogram magic-prompt, so no
  separate text client/API key is required.
- Rejects useGoogleSearch and image-to-image editing (unsupported on v4).
- Docs (README, server.json) and tests updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@shinpr
shinpr self-requested a review June 29, 2026 04:29
@shinpr

shinpr commented Jun 29, 2026

Copy link
Copy Markdown
Owner

Thanks for this. A few points before it can move forward.

The core value of this MCP is creating a structured prompt and generating an image from it. So adding a new image model means the prompt-optimization policy and quality level have to be aligned across providers. When GPT-Image-2 was added, we evaluated that the optimized prompt was equivalent in quality, speed, and cost.

As a prerequisite, please verify against the live API. We can't merge anything that hasn't been verified end to end.

On magic-prompt: with it ON, generation depends entirely on magic-prompt, whose output isn't visible. So if you want it ON, please confirm and evaluate that magic-prompt's prompt is equivalent or better, or attach evidence. Otherwise, optimize the prompt on the MCP side and use AUTO to let magic-prompt add on top of it. As a note, the docs list an OFF option, so disabling it looks possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants